import mongoose from 'mongoose'

let db = mongoose.connection
mongoose.Promise = global.Promise
// 连接
mongoose.connect('mongodb://tyler:123456@localhost:27017/testTyler', {useMongoClient: true})
// 事件监听
db.on('open', () => {
  console.log('数据库连接成功!')
})
db.on('error', error => {
  console.log('数据库连接失败!', error)
})

